package com.shopAttr.dao;

import org.apache.ibatis.annotations.*;

import com.shopAttr.bean.ShopAttr;

import java.util.List;

@Mapper
public interface ShopAttrMapper {

	@Insert("insert into sys_shop_attr set id=#{id},name=#{name},note=#{note},pid=#{id},createDate=#{createDate}")
	public int insert(ShopAttr shopAttr);
	@Delete("delete from sys_shop_attr where id=#{id}")
	public int delete(String id);
	
	@Update("update sys_shop_attr set  name=#{name},note=#{note} where id=#{id}")
	public int update(ShopAttr shopAttr);

	@Select("select * from sys_shop_attr where id=#{id}")
	public ShopAttr get(String id);

	@Select("select count(1) from sys_shop_attr where name=#{name} and shopId=#{shopId}")
	public  int getByNameAndShopId(@Param("name") String name,@Param("shopId") String shopId);

	@Select("select * from sys_shop_attr where pid=#{pid}")
	public List<ShopAttr> getByPid(String pid);


	@Select("select * from sys_shop_attr where  shopId=#{shopId} and pid is null")
	public List<ShopAttr> getFristByShopId(String shopId);

	@Select("select count(1) from sys_shop_attr where id not in(#{id}) and name=#{name}")
	public int getByNameAndNoInId(@Param("name")String name,@Param("id")String id);


	@Select("select * from sys_shop_attr where  shopId=#{shopId}")
	public List<ShopAttr> getByShopId(String shopId);
}
